Setting Up

Before we start, there are a few parts that we need to set up to get started. I assume you already have a copy of Python installed. If you are new to Python, Continuum Analytics' Anaconda package is great. Just download and install.


Setting Up An Oanda Account

We also need an account with Oanda and install an associated package call oandapy to get the example working.

To set up a practice account with Oandas, head to their website and you should see something similar to the following. Select the demo option and you should see the fxTrade Practice account application page.


Installing oandapy

Once the account has been set up, we need to install the oandapy to play nicely with the Oanda API. You can install oandapy using pip. Copy and paste the following line to your command line / terminal:

pip install git+https://github.com/oanda/oandapy.git


Oanda fxTrade Practive Account View


API Key and Account ID

Before we close off this section, there are two more things we need to do. We need the API Key and the Account ID. To obtain the API Key, we to go to Manage API Access under My Services. For Account ID, it can be obtained from Managed Funds. I attached a screehshot below to help you locate these.

API Key

When you select Manage API Access, you should be brought to the following screen. Make sure you read the API License Agreement and once you agreed with the terms and conditions, click the Generate button.

You should then come to the following screen with your API Key. Copy it to your clipboard and keep it somewhere safe! Along with the Account ID, these provides almost full access to your Oanda account.

Head back to the main screen and select the Managed Funds button and you should come to the following Summary of Accounts - fxTrade Practice screen. You Account ID is next to the Primary Account Name.

Account ID